import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

//主题色
Color kAppThemeColor = kAppColor('#FFC657');
Color kAppLeftColor = kAppColor('#F2C661');
Color kAppRightColor = kAppColor('#FFA216');
Color kAppMainColor = const Color(0xFF6D4EFA);
//背景色
Color kAppBcgColor = const Color(0xFFF9F9F9);
//一级文字
Color kAppTextColor = kAppColor('#404040');
//二级文字
Color kAppSubTextColor = kAppColor('#202020');
//三级文字
Color kAppSub2TextColor = kAppColor('#000000').withOpacity(0.3);
//阴影
Color kShadowColor = const Color(0xeef8f8f8);
//白色
Color kAppWhiteColor = const Color(0xFFFFFFFF);

///黑色
Color kAppBlackColor = const Color(0xFF333333);
//下划线
Color kAppLineColor = const Color(0xFF979797).withOpacity(0.1);

Color kAppColor(String hex) {
  try {
    String colorStr = hex.replaceAll("#", "");
    String prefix = (8 == hex.length) ? "0x" : "0xFF";
    return Color(int.parse(prefix + colorStr));
  } catch (e) {
    return Colors.white;
  }
}

Divider kAppDivider = Divider(height: 1, color: kAppColor("#CCCCCC"));

Color randomColor() {
  var random = Random();
  int r = random.nextInt(255);
  int g = random.nextInt(255);
  int b = random.nextInt(255);
  return Color.fromARGB(255, r, g, b);
}